package servlet;

import bean.Course;
import dao.CourseDao;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class ServletEditCourse extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int id = Integer.parseInt(req.getParameter("id"));
        Course course = new CourseDao().get(id);
        req.setAttribute("course", course);
        req.getRequestDispatcher("editCourse.jsp").forward(req, resp);
    }
}
